#ifndef __CLI_PARSE__STATES_H__
#define __CLI_PARSE__STATES_H__

#include "../states.h"
#include "structs.h"

#include "../command.h" // eTB_Variable ...

#include "player.h"

#include "../../Epsilon/platforms.h" /// MAX_PATH on UNIX

class e3dTexture;
class e3dRenderContext;
class OpenALContext;

namespace cli_parse
{
  class ModuleStates : public eTestbedModuleStates, eTB_iVariableListener {
  public:
    bool  r_tex;
    bool  r_tex_align;
    bool  r_animate;
    bool  r_actors;
    bool  r_wireframe;
    bool  r_triangle_strips;
    bool  r_tesselate_triangles;
    bool  r_combine_batches;

    bool  r_shadows;
    bool  r_depth_first;
    bool  r_lights;
    bool  r_hdr;
    bool  r_ssao;

    int   r_deferred_mode;  // 0 = None, 1 = Composite, 2 = Debug
    float r_deferred_scale; // Ratio between deferred buffers vs. window size

    bool  r_fog;
    float r_fog_start;
    float r_fog_end;
    float r_fog_density;
    int   r_fog_mode;

    bool  r_null; /* If true, do not render anything... */

    float r_global_brightness;
    float r_light_scale;

    /* Texture IDs to display in a special debugging sub-window. */
    int   r_debug_tex_id;
    int   r_debug_flat_id;
    int   r_debug_effect_id;

    int   r_texgen; ///< Which algorithm to use to generate texcoords...
                    // 0 = Enhanced   (under development, much closer to 4dx)
                    // 1 = Compatible (flawed, but generally acceptable)
                    // 2 = Legacy     (very poor results)
    int   r_debug_tex_line; ///< Linedef to do detailed tex coord debugging on.

    bool         cl_all_rooms;
    unsigned int cl_cur_room;
    unsigned int cl_cam_room;
    bool         cl_need_pick;

    bool         cl_pause;     /* Pause timed updates... */

    unsigned int cl_level_num; /* The level to load. */
    unsigned int cl_room_num;  /* The room to enter. */

    PickingData  cl_picked_sector;
    PickingData  cl_picked_line;

    TCHAR cli_file_name [MAX_PATH];

    e3dTexture*        ulTextures           [MAX_TEXTURES + 1];
    e3dTexture*        ulTexNormals         [MAX_TEXTURES + 1];
    e3dTexture*        ulFlatTextures       [MAX_FLATS    + 1];
    e3dTexture*        ulFlatNormals        [MAX_FLATS    + 1];
    e3dTexture*        ulEffectTextures     [MAX_BITMAPS  + 1];

    bool               loadedTextures       [MAX_TEXTURES + 1];
    bool               loadedFlatTextures   [MAX_FLATS    + 1];
    bool               loadedEffectTextures [MAX_BITMAPS  + 1];

    e3dRenderContext*  render_context;
    OpenALContext*     sound_context;

    Player cl_player;
    bool   cl_collision;
    bool   cl_gravity;

    ModuleStates (void);

    bool OnVarChange (eTB_Variable* var, void* val);
  };

  extern ModuleStates* states;
};

#endif /* __CLI_PARSE__STATES_H__ */
